Frontend/cosmo encumber updates#1465
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughMode-aware encumbrance changes: NPDB category and discipline option lists now vary by app mode; NPDB input toggles between multi- and single-select; encumbrance submission normalizes NPDB categories to an array; locales and mock API signature updated; minor CSS selector changes for Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Component as License/Privilege Component
participant Store as Vuex Store
participant API as DataApi (mock)
User->>Component: open encumber modal / submit form
Component->>Store: read isAppModeJcc / isAppModeCosmetology
Store-->>Component: return mode flags
alt JCC mode (multi)
Component->>Component: render InputSelectMultiple, Joi.array() validation
Component->>API: encumberLicense(..., npdbCategory, npdbCategories: array, startDate)
else Cosmetology / other (single)
Component->>Component: render InputSelect, Joi.string() validation
Component->>API: encumberLicense(..., npdbCategory, npdbCategories: [value], startDate)
end
API-->>Component: mock response
Component-->>User: show result
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
webroot/src/components/LicenseCard/LicenseCard.ts (1)
273-305: Consider centralizing the NPDB app-mode option shaping.This logic now mirrors
webroot/src/components/PrivilegeCard/PrivilegeCard.ts:245-272. Pulling the mode-specific filtering/value-normalization into a shared helper/composable would reduce drift between the license and privilege encumber flows.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@webroot/src/components/LicenseCard/LicenseCard.ts` around lines 273 - 305, Move the mode-specific NPDB option shaping into a shared helper/composable and use it from both LicenseCard.get npdbCategoryOptions and PrivilegeCard (the duplicated logic currently in the npdbCategoryOptions getter and PrivilegeCard's equivalent block); implement a single function (e.g., normalizeNpdbOptions(options, { isAppModeJcc, isAppModeCosmetology })) that accepts the base options from this.$tm('licensing.npdbTypes') and returns the filtered/normalized list (including lowercasing values for cosmetology, injecting the empty select option, and excluding fraud/consumer harm for JCC), then replace the in-place transformations in npdbCategoryOptions and the PrivilegeCard code with calls to that helper and keep shouldAllowNpdbMultiSelect as the simple boolean derived from isAppModeJcc.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@webroot/src/components/LicenseCard/LicenseCard.ts`:
- Around line 547-552: In the encumbrance object construction inside
LicenseCard.ts (the investigation submit path), replace the incorrect use of
formData.encumberModalNpdbCategories.value for the startDate with the proper
start-date field from the form (e.g., formData.encumberModalStartDate.value or
the form key used for the start date in the component). Update the startDate
assignment so it reads the actual start-date form value instead of the NPDB
categories value to prevent turning date into category data.
In `@webroot/src/components/PrivilegeCard/PrivilegeCard.less`:
- Around line 314-316: The current rule using &:first-child on the static row
adds margin when there is only a single .static-input, creating an unwanted gap;
update the selector so the margin-bottom is applied only when the element is not
the last child (e.g., change the &:first-child rule to use &:not(:last-child) or
otherwise apply margin-bottom to .static-input elements except the last one) so
single-field static rows do not get extra bottom spacing; locate this in the
PrivilegeCard styles where the .static-container/.static-input first-child rule
is defined and replace the selector accordingly.
In `@webroot/src/components/PrivilegeCard/PrivilegeCard.ts`:
- Around line 259-265: The code is lowercasing NPDB category keys during the
options mapping (in the options = options.filter(...).map(...) block), which
breaks exact-match downstream lookups for licensing.npdbTypes like
"Fraud"/"Consumer Harm"/"Other"; remove the transformation so option.value is
not modified (i.e., delete the option.value = option.value?.toLowerCase() line)
and leave the filter using includeList.includes(option.value) intact (or, if
null-safety is needed, preserve option.value as-is but guard against undefined
without changing case).
---
Nitpick comments:
In `@webroot/src/components/LicenseCard/LicenseCard.ts`:
- Around line 273-305: Move the mode-specific NPDB option shaping into a shared
helper/composable and use it from both LicenseCard.get npdbCategoryOptions and
PrivilegeCard (the duplicated logic currently in the npdbCategoryOptions getter
and PrivilegeCard's equivalent block); implement a single function (e.g.,
normalizeNpdbOptions(options, { isAppModeJcc, isAppModeCosmetology })) that
accepts the base options from this.$tm('licensing.npdbTypes') and returns the
filtered/normalized list (including lowercasing values for cosmetology,
injecting the empty select option, and excluding fraud/consumer harm for JCC),
then replace the in-place transformations in npdbCategoryOptions and the
PrivilegeCard code with calls to that helper and keep shouldAllowNpdbMultiSelect
as the simple boolean derived from isAppModeJcc.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: ea11714b-da99-4c3a-b7cb-7af4e42ee2a9
⛔ Files ignored due to path filters (1)
webroot/yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (9)
webroot/src/components/LicenseCard/LicenseCard.lesswebroot/src/components/LicenseCard/LicenseCard.tswebroot/src/components/LicenseCard/LicenseCard.vuewebroot/src/components/PrivilegeCard/PrivilegeCard.lesswebroot/src/components/PrivilegeCard/PrivilegeCard.tswebroot/src/components/PrivilegeCard/PrivilegeCard.vuewebroot/src/locales/en.jsonwebroot/src/locales/es.jsonwebroot/src/network/mocks/mock.data.api.ts
|
@jlkravitz This is ready for your review. |
jlkravitz
left a comment
There was a problem hiding this comment.
LGTM! @isabeleliassen Good to merge.
Requirements List
Description List
Testing List
yarn test:unit:allshould run without errors or warningsyarn serveshould run without errors or warningsyarn buildshould run without errors or warningsCloses #1315
Summary by CodeRabbit
New Features
Bug Fixes
Style